// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    status: '',
    active:''
  },

  go() {
    wx.redirectTo({
      url: '../../xiaoneng/xiaoneng'
    })
  },
  goTo() {
    var _ = this;
    var active = _.data.active;
    if(active){
      wx.redirectTo({
        url: '../result/result'
      })
    } else {
      wx.showToast({
        title: '请选择学校！',
        icon:'none'
      })
    }
  

  },
  goBefore() {
    wx.redirectTo({
      url: '../zhuanye/zhuanye'
    })

  },
  chooseyx(e) {
    var _ = this;
    console.log(e.currentTarget.dataset.yx)
    _.setData({
      active:e.currentTarget.dataset.yx
    })
    wx.setStorageSync('xuexiao', e.currentTarget.dataset.yx)
  },


  onLoad(options) {
    var _ = this;
    var shengben_zy = wx.getStorageSync('shbenzhuanye');
    var zhuanye_category = wx.getStorageSync('zhuanye_category');
    var gaoshuleibie = wx.getStorageSync('gaoshuleibie');
    console.log(shengben_zy)
    console.log(zhuanye_category)
    wx.request({
      url: 'https://zg99.offcn.com/index/chaxun/getlist?actid=45895&callback=?',
      data: {
        level: '1',
        tabnum: '2',
        Professional_category: zhuanye_category,
        benke_zy: shengben_zy,
        gaoshuleibie: gaoshuleibie,
        phone:'15205451183',
        limits:200
      },
      success: function (res) {
        var jsonStr = res.data;
        jsonStr = jsonStr.replace("(", "");
        jsonStr = jsonStr.replace(")", "");
        if (typeof jsonStr != 'object') {
          jsonStr = jsonStr.replace(/\ufeff/g, ""); //字符串转化JSON对象
          var theJson = JSON.parse(jsonStr);
        }
        console.log(theJson.lists)
        _.setData({
          lists: theJson.lists
        })

      },

    })

    // 清除缓存数据
    // wx.removeStorageSync("zhuanye")
  },

})